package com.weic.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping(value = "/second")
public class SecondController {

    @RequestMapping(value = "/testPathVariables/{id}/{username}")
    public String testPathVariables(@PathVariable("id") Integer id,@PathVariable("username") String username){
        return "id:"+id+" username:"+username;
    }


    @RequestMapping(value = "/dealData/{id}",method = RequestMethod.GET)
    public String getData(@PathVariable("id") Integer id){
        System.out.println("id:"+id);
        return "get - id:"+id;
    }
    @RequestMapping(value = "/dealData/{id}",method = RequestMethod.POST)
    public String addData(@PathVariable("id") Integer id){
        System.out.println("id:"+id);
        return "post - id:"+id;
    }
    @RequestMapping(value = "/dealData/{id}",method = RequestMethod.PUT)
    public String updateData(@PathVariable("id") Integer id){
        System.out.println("id:"+id);
        return "put - id:"+id;
    }
    @RequestMapping(value = "/dealData/{id}",method = RequestMethod.DELETE)
    public String delData(@PathVariable("id") Integer id){
        System.out.println("id:"+id);
        return "delete - id:"+id;
    }
}
